package 普通Socket.Client;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;

public class Client1 {
	static String clientName = "Mike";
	// 端口号
	public static int portNo = 8585;

	public static void main(String[] args) throws IOException {
		// 设置连接地址类,连接本地
		InetAddress addr = InetAddress.getByName("172.31.13.92");
		// 要对应服务器端的3333端口号
		Socket socket = new Socket(addr, portNo);
		try {
			System.out.println("socket = " + socket);
			// 设置IO句柄
			BufferedReader in = new BufferedReader(new InputStreamReader(socket
					.getInputStream()));
			PrintWriter out = new PrintWriter(new BufferedWriter(
					new OutputStreamWriter(socket.getOutputStream())), true);
			out.println("192.168.1.170 2014-11-21 17:03:27 003D518B 01 01");
			String str = in.readLine();
			System.out.println(str);
			out.println("byebye1");
		} finally {
			System.out.println("close the Client socket and the io.");
			socket.close();
		}

	}

}
